package com.oig.sys.base.dao;

import com.oig.sys.base.entity.TbHsGoods;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
@author wuxl
*/
public interface ITbHsGoodsDao extends JpaRepository<TbHsGoods, String>, JpaSpecificationExecutor<TbHsGoods> {

	@Query("from TbHsGoods g where g.hsCode=:hsCode")
	TbHsGoods getByHsCode(@Param("hsCode") String hsCode);

	@Query("select g.name from TbHsGoods g where g.hsCode=:hsCode")
	String getNameByHsCode(@Param("hsCode") String hsCode);

	List<TbHsGoods> findAllByHsCodeIn(@Param("hsCode") List<String> hsCode);
}
